package cn.lg.soar.system.feign;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.model.AuthRole;
import cn.lg.soar.system.api.model.RoleDTO;
import cn.lg.soar.system.api.service.IRoleApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * @author luguoxiang
 * @date 2022/1/2
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.system.auth.client.RoleApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/role",
        contextId="RoleApiFeign"
)
public interface RoleApiFeign extends IRoleApi {


    @GetMapping("idsByUserId")
    @Override
    List<Long> idsByUserId(@RequestParam("userId") Long userId);

    @GetMapping("idsByOrgId")
    @Override
    List<Long> idsByOrgId(@RequestParam("orgId") Long orgId);

    @GetMapping("idsByPostId")
    @Override
    List<Long> idsByPostId(@RequestParam("postId") Long postId);

    @GetMapping("listByCodes")
    @Override
    List<RoleDTO> listByCodes(@RequestParam("codes") Collection<String> codes);

    @GetMapping("listByIds")
    @Override
    List<RoleDTO> listByIds(@RequestParam("ids") List<Long> ids);

    @GetMapping("getById")
    @Override
    RoleDTO getById(@RequestParam("id") Long id);

    @GetMapping("codesByIds")
    @Override
    List<String> codesByIds(@RequestParam("roleIds") List<Long> roleIds);

    @GetMapping("userRoleList")
    @Override
    List<AuthRole> userRoleList(@RequestParam("userId") Long userId);

}
